Servers API
POST /servers
Description
This API endpoint retrieves a list of all servers with their detailed information.
Request Body
The request uses GraphQL to perform the servers
query, which does not require any variables.
Query:
query servers {
servers {
id
hostName
publicIp
type
privateIp
city
country
continent
secret
ports
sshUsername
sshKey
killCommand
rootCommand
description
hero
spot
zeus
bridgeIp
bridgeCountry
}
}
GraphQL Variables:
{}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query servers {\n servers {\n id\n hostName\n publicIp\n type\n privateIp\n city\n country\n continent\n secret\n ports\n sshUsername\n sshKey\n killCommand\n rootCommand\n description\n hero\n spot\n zeus\n bridgeIp\n bridgeCountry\n }\n}","variables":{}}'
Response:
-
Success (200 OK):
- The response includes a list of all servers with detailed information for each server.
{
"data": {
"servers": [
{
"id": 1,
"hostName": "server-01",
"publicIp": "203.0.113.1",
"type": "VPS",
"privateIp": "10.0.0.1",
"city": "New York",
"country": "USA",
"continent": "North America",
"secret": "xyz123",
"ports": "22, 80, 443",
"sshUsername": "admin",
"sshKey": "ssh-rsa AAAAB3...xyz",
"killCommand": "shutdown -h now",
"rootCommand": "sudo su",
"description": "Primary server for application",
"hero": false,
"spot": false,
"zeus": true,
"bridgeIp": "192.168.1.1",
"bridgeCountry": "USA"
},
{
"id": 2,
"hostName": "server-02",
"publicIp": "203.0.113.2",
"type": "Dedicated",
"privateIp": "10.0.0.2",
"city": "San Francisco",
"country": "USA",
"continent": "North America",
"secret": "abc456",
"ports": "22, 80, 443, 3306",
"sshUsername": "root",
"sshKey": "ssh-rsa AAAAB3...abc",
"killCommand": "shutdown -h now",
"rootCommand": "sudo su",
"description": "Backup server",
"hero": true,
"spot": true,
"zeus": false,
"bridgeIp": "192.168.1.2",
"bridgeCountry": "USA"
}
// Additional servers...
]
}
} -
Error (4XX/5XX):
- If there is an issue retrieving the server list, such as a server error or misconfiguration, the response will include an error message and status code.
Note:
Ensure that the GraphQL server is properly configured to handle the servers
query and that it can return a comprehensive list of servers for accurate results.